import React, { useState, useEffect } from "react";
import { Form, Input, Button, Col, Breadcrumb, Row } from "antd";

const PersonInfo = (props) => {
  //接收数据，数据渲染
  const [from, setFrom] = useState([]);
  const [form1] = Form.useForm();
  const getdata = () => {
    let obj = JSON.parse(sessionStorage.getItem("record"));
    // console.log(obj);
    form1.setFieldsValue(obj);
  };

  useEffect(() => {
    getdata();
  }, []);

  const ret = () => {
    props.history.go(-1);
  };

  return (
    <div>
      <Breadcrumb
        style={{
          marginBottom: 24,
        }}
      >
        <Breadcrumb.Item> 病人入院信息 </Breadcrumb.Item>{" "}
        <Breadcrumb.Item> 患者信息 </Breadcrumb.Item>{" "}
      </Breadcrumb>
      <div
        className="site-layout-background huan"
        style={{
          padding: 24,
          margin: 12,
          minHeight: 300,
          textAlign: "center",
        }}
      >
        <h1
          style={{
            backgroundColor: "burlywood",
            fontSize: 20,
          }}
        >
          {" "}
          患者个人信息{" "}
        </h1>{" "}
        <Form form={form1}>
          {" "}
          {/* // 第一行  */}{" "}
          <Row>
            {" "}
            {/* 第一列 */}{" "}
            <Col span={6} offset={2}>
              <Form.Item
                label="姓名"
                name="xingMing"
                initialValue={[from.xingMing]}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/*的第二列  */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                name="shenFenZhengHao"
                label="身份证号"
                initialValue={[from.shenFenZhengHao]}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/* 第三列 */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="性别类"
                name="xingBie"
                initialValue={from.xingBie}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
          </Row>{" "}
          {/* //第二行 */}{" "}
          <Row>
            {" "}
            {/* 第一列 */}{" "}
            <Col span={6} offset={2}>
              <Form.Item label="住址" name="zhuZhi" initialValue={from.zhuZhi}>
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/*的第二列  */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="医疗证号"
                name="yiLiaoZhengHao"
                initialValue={from.yiLiaoZhengHao}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/* 第三列 */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="婚姻类"
                name="hunFou"
                initialValue={from.hunFou}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
          </Row>{" "}
          {/* 第三行 */}{" "}
          <Row>
            <Col span={6} offset={2}>
              <Form.Item label="关系" name="guanXi" initialValue={from.guanXi}>
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/*的第二列  */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="疾病诊断"
                name="jiBingZhenDuan"
                initialValue={from.jiBingZhenDuan}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/* 第三列 */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="联系人"
                name="lianXiRen"
                initialValue={from.lianXiRen}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
          </Row>{" "}
          {/* 第四行 */}{" "}
          <Row>
            <Col span={6} offset={2}>
              <Form.Item
                label="电话"
                name="lianXiRenDianHua"
                initialValue={from.lianXiRenDianHua}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/*的第二列  */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="记账方式"
                name="jieZhangFangShi"
                initialValue={from.jieZhangFangShi}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/* 第三列 */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="费别类"
                name="jiaoFeiFangShi"
                initialValue={from.jiaoFeiFangShi}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
          </Row>{" "}
          {/* 第五行 */}{" "}
          <Row>
            <Col span={6} offset={2}>
              <Form.Item label="科别" name="keBie" initialValue={from.keBie}>
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/*的第二列  */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="ICD9编码"
                name="icd9BianMa"
                initialValue={from.icd9BianMa}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/* 第三列 */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="预交款"
                name="yuJiaoKuan"
                initialValue={from.yuJiaoKuan}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
          </Row>{" "}
          {/* 第六行 */}{" "}
          <Row>
            <Col span={6} offset={2}>
              <Form.Item
                label="床号"
                name="chuangHao"
                initialValue={from.chuangHao}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/*的第二列  */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="出生日期"
                name="chuShengRiQi"
                initialValue={from.chuShengRiQi}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/* 第三列 */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="籍贯类"
                name="jiGuan"
                initialValue={from.jiGuan}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
          </Row>{" "}
          {/* 第七行 */}{" "}
          <Row>
            <Col span={6} offset={2}>
              <Form.Item label="职业" name="zhiYe" initialValue={from.zhiYe}>
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/*的第二列  */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="工作单位"
                name="gongZuoDanWei"
                initialValue={from.gongZuoDanWei}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/* 第三列 */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="职称类"
                name="zhiCheng"
                initialValue={from.zhiCheng}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
          </Row>{" "}
          {/* 第八行 */}{" "}
          <Row>
            <Col span={6} offset={2}>
              <Form.Item label="国籍" name="guoJi" initialValue={from.guoJi}>
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/*的第二列  */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="入院时间"
                name="ruYuanRiQi"
                initialValue={from.ruYuanRiQi}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
            {/* 第三列 */}{" "}
            <Col span={6} offset={1}>
              <Form.Item
                label="住院号"
                name="zhuYuanHao"
                initialValue={from.zhuYuanHao}
              >
                <Input readOnly={true} />
              </Form.Item>{" "}
            </Col>{" "}
          </Row>{" "}
        </Form>{" "}
      </div>{" "}
      <div
        className="site-layout-background huan"
        style={{
          padding: 24,
          margin: 12,
          minHeight: 20,
          textAlign: "center",
        }}
      >
        <Button
          type="primary"
          style={{
            marginRight: 30,
            width: 100,
            height: 40,
          }}
        >
          {" "}
          新增{" "}
        </Button>{" "}
        <Button
          style={{
            backgroundColor: "#40FF00",
            width: 100,
            height: 40,
          }}
          onClick={ret}
        >
          {" "}
          返回{" "}
        </Button>{" "}
      </div>{" "}
    </div>
  );
};

export default PersonInfo;
